package net.chasing.androidbaseconfig.widget.layout_manager;

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

/**
 * 该类解决的问题：
 * 当RecyclerView里面包含EditText时，每次EditText获取焦点，Rcv就会自动滚动到最前
 */
public class FixChildScrollLinearLayoutManager extends LinearLayoutManager {
    public FixChildScrollLinearLayoutManager(Context context) {
        super(context);
    }

    public FixChildScrollLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
        super(context, orientation, reverseLayout);
    }

    public FixChildScrollLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    public boolean requestChildRectangleOnScreen(@NonNull RecyclerView parent, @NonNull View child, @NonNull Rect rect,
                                                 boolean immediate, boolean focusedChildVisible) {
        return false;
    }
}
